import { ajaxPost } from 'api/axios'
import { HttpUrl, ERR_OK } from 'api/config'

const actions = {
  EDIT_PSD ({ commit }, id) {
    return new Promise(async resolve => {
      const url = `${HttpUrl}/manage/userinfo/resetPwd?userId=${id}`

      const res = await ajaxPost(url)

      if (res.code === ERR_OK) {
        SuccessMessage('操作成功')
        resolve(res.data)
      } else {
        ErrorMessage(res.msg || '操作失败')
        resolve(false)
      }
    })
  }
}

export default actions
